const passwordKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYqxNMjTRQIvf9JylgBaCOwdAvE3XwWJownq8K8iy5FDMaC7wYHmbw6s+B66TcOYLZFy10mUYxkV+J+epmpnIxMSdXYZ7sU2pqbB9tZmtdkiy4YLoXQUirwaZsEJSApQF/P9StfqAralyG2wguBYyujF8EdV4Kbrb5vD+QTxcwxQIDAQAB';
import { JSEncrypt } from 'jsencrypt'
// public function 
function timeTampt(d){ 
    var mouth = d.getMonth() + 1 > 9 ? d.getMonth() + 1 : '0' +  (d.getMonth() + 1);
    var date = d.getDate() > 9 ? d.getDate()  : '0' +  d.getDate() ;
    return d.getFullYear() + '-' + mouth + '-' + date 
}
function openNewWidow(that,name,pramas,query){
    const { href } = that.$router.resolve({
        name: name,
        params: pramas ? pramas : {},
        query: query? query: {}
    });
    window.open(href, '_blank');
}
function encrypt(password){
    let encrypt = new JSEncrypt(); 
    encrypt.setPublicKey(passwordKey);
    let password_Encry = encrypt.encrypt(password);
    return password_Encry
}

export default{ 
    openNewWidow,
    timeTampt,
    encrypt
}